<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/login.css" />
<script type="text/javascript" src="js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="js/login.js"></script>
<script src="layui/layui.all.js"></script>
</head>

<body>
	<div class="page">
		<div class="loginwarrp">
			<div class="logo">用户注册</div>
			<div class="login_form">
				<form id="form" class="form-horizontal" role="form"
					>
					<li class="login-item "><span>用户名：</span> <input type="text"
						id="userName" name="username" class="login_input "> <span
						id="count-msg" class="error "></span></li>
					<li class="login-item "><span>密 码：</span> <input
						type="password" id="userPwd" name="userPwd" class="login_input ">
						<span id="pwd-msg " class="error "></span></li>
					<li class="login-item "><span>确认密 码：</span> <input
						type="password" id="repwd" name="repwd" class="login_input ">
						<span id="repwd-msg " class="error "></span></li>
					<li class="login-item "><span>手机号码：</span> <input type="text"
						id="userTel" name="userTel" class="login_input "> <span
						id="tel-msg " class="error "></span></li>
						<li class="login-item "><span>地址：</span><input type="text" required="required" class="form-control"
								name="userAddress" id="userAddress" /><span
						id="address-msg " class="error "></span></li>

					<li class="login-item "><span>性别：</span> <select
						class="form-control" id="userSex" name="userSex">
							<option value="男">男</option>
							<option value="女">女</option>
					</select><span id="tel-msg " class="error "></span></li>
					<div class="clearfix "></div>
					<li class="login-sub "><input type="button" id="submit" name="Submit "
						value="注册 " /> <input type="reset" name="Reset " value="重置 " />

					</li>

				</form>
			</div>
		</div>
	</div>


	<script type="text/javascript " src="js/canvas-particle.js "></script>
	
	<script>
		$(function(){
			
		
				$("#submit").click(function(){
					var userName=$("#userName").val();
					var userPwd=$("#userPwd").val();
					var userSex=$("#userSex").val();
					var userTel=$("#userTel").val();
					var userAddress=$("#userAddress").val();
					$.post("LoginServlet?op=regist","userName="+userName+"&userPwd="+userPwd+"&userSex="+userSex+
							"&userTel="+userTel+"&userAddress="+userAddress,function(data){
						console.log(data);
						if(data=="true"){
							layer.confirm('注册成功!', {
								  btn: ['确认', '取消'] //可以无限个按钮
								  ,btn3: function(index, layero){
								    //按钮【按钮三】的回调
								  }
								}, function(index, layero){
									location.href="login.html";
								}, function(index){
									location.href="login.html";
								});
							layui.use('layer', function(){
								  var layer = layui.layer;
								  
								  
								});  
						}else{
							layui.use('layer', function(){
								  var layer = layui.layer;
								  
								  layer.msg('系统错误！请稍后再试');
								});  
						}
					});
				});
			
		});
	</script>
</body>
</html>